<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta name="Generator" content="EditPlus®">
	<meta name="Author" content="">
	<meta name="Keywords" content="">
	<meta name="Description" content="">
	<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
	<meta name="renderer" content="webkit">
	<link rel="shortcut icon" type="image/x-icon" href="http://oydt3ttm3.bkt.clouddn.com/{{ $sate['icon'] }}">
	<title>{{ $sate['name'] }}</title>
    <link rel="stylesheet" href="{{ asset('css/base.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ asset('css/login.css') }}">
		<link rel="stylesheet" type="text/css" href="{{ asset('btn.css') }}">
</head>
<body>

<div class="w">
	<div id="logo">
		<a href="index.html">
			<a href="{{ route('Home.index') }}"><img src="http://oydt3ttm3.bkt.clouddn.com/{{ $sate['logo'] }}" style="width:190px"></a>
		</a>
		<b></b>
	</div>
</div>
<div id="content">
  <div class="login-wrap">
  	<div class="w">
  		<div class="login-form">
  			<div class="login-tab login-tab-l">
  				<a href="javascript:;">手机登录</a>
  			</div>
  			<div class="login-tab login-tab-r">
  				<a href="javascript:;">账号登录</a>
  			</div>
  			<div class="login-box" style="visibility: visible; display:block">
  			  <div class="mt tab-h"></div>
  			  <div class="msg-wrap"></div>
  			  <div class="mc">
  			  	<div class="form">
  			  		<form action="{{ route('home.dologin') }}" id="formlogin1" method="post">
								{{ csrf_field() }}

								@if (session('message'))
								<div class="Huialert Huialert-error">
									<h4 style="color:red;margin-top:10px;">{{ session('message') }}</h4>
								</div>
								@endif
								@if (count($errors) > 0)
								<div class="Huialert Huialert-danger">
									<ul>
										@foreach ($errors->all() as $error)
										<li><h4 style="color:red;margin-top:10px;">{{ $error }}</h4></li>
										@endforeach
									</ul>
								</div>
								@endif

  			  			<div class="item item-fore1 item-error">
  			  				<label for="phone" class="login-label name-label"></label>
  			  				<input type="text" name="phone" id="phone" class="itxt" placeholder="已验证手机">
  			  				<span class="clear-btn" style="display:inline;"></span>
  			  			</div>
								<h4 id="phone-error" style="color:red;"></h4>
  			  			<!-- 密码输入框fore2 -->
  			  			<div id="entry" class="item item-fore2">
  			  				<label class="login-label pwd-label" for="nloginpwd"></label>
  			  				<input type="password" id="password" name="password" class="itxt itxt-error" placeholder="密码">
  			  			</div>
								<h4 id="password-error" style="color:red;"></h4>

								<!-- 登录按钮开始 -->
								<div class="item item-fore4">
									<div class="safe">
										<span class="forget-pw-safe">
											<a href="{{ route('home.beforpass') }}">忘记密码</a><br><a href="{{ route('home.emailgetreturn') }}">邮箱找回</a>
										</span>
									</div >
								</div>
                <div class="item item-fore5" style="margin-top:50px;">
                	<div class="login-btn">
                		<button id="passwordlogin" class="btn-img btn-entry" style="margin-top:65px;">登&nbsp;&nbsp;&nbsp;&nbsp;录</button>
                	</div>
                </div>
  			  		</form>
  			  	</div>
  			  </div>
  			</div>
				<!-- 另一个登录页面开始 -->
  			<div class="qrcode-login">
					<div class="mt tab-h"></div>
  			  <div class="msg-wrap" style="margin-bottom:32px;"></div>
  			  <div class="mc">
						<div class="form">
							<form action="{{ route('home.phonecaptchalogin') }}" id="formlogin" method="post">

								{{ csrf_field() }}

								@if (session('message'))
								<div class="Huialert Huialert-error">
									<h4 style="color:red;margin-top:10px;">{{ session('message') }}</h4>
								</div>
								@endif
								@if (count($errors) > 0)
								<div class="Huialert Huialert-danger">
									<ul>
										@foreach ($errors->all() as $error)
										<li><h4 style="color:red;margin-top:10px;">{{ $error }}</h4></li>
										@endforeach
									</ul>
								</div>
								@endif

								<div class="item item-fore1 item-error">
									<label for="loginname" class="login-label name-label"></label>
									<input type="text" name="phone" id="sendphone" class="itxt" placeholder="已验证手机">
									<h4 id="sendphone-error" style="color:red;margin-bottom:5px;"></h4>
								</div>
								<!-- 密码输入框fore2 -->
								<div id="entry" class="item item-fore2" style="margin-bottom:15px;">
									<label class="login-label pwd-label" for="nloginpwd"></label>
									<input type="text" id="code" name="code" class="itxt itxt-error" placeholder="验证码">
									<h4 id="phonecode-error" style="color:red;margin-bottom:5px;"></h4>
								</div>
								<a id="phonecode" style="background:#ccc;display:block;padding:0" class="button button-rounded button-tiny">获取</a>
								<div class="item item-fore4">
									<div class="safe" style="margin-left:258px;margin-top:20px;">
										<span class="forget-pw-safe">
											<a href="{{ route('home.beforpass') }}">忘记密码</a>
											<a href="{{ route('home.beforpass') }}">邮箱找回</a>
										</span>
									</div>
									<input type="submit" id="sendphonemessagesubmit" style="background:#61706B;width:302px;margin-top:10px;height:45px;margin-left:1px;" value="登&nbsp;&nbsp;&nbsp;&nbsp;录" class="button button-action button-rounded">
								</form>
							</div>
						</div>
					</div>
  			</div>
				<!-- 另一个登录页面结束 -->

  			<div class="coagent" id="kbCoagent">
  				<ul>
  					<li class="extra-r">
  					   <div class="regist-link">
  						<a href="{{ route('home.register') }}" class="">
  							<b></b>立即注册
  						</a>
  					   </div>
  					</li>
  				</ul>
  			</div>
  		</div>
  	</div>
  	<div class="login-banner" style="background-color: #E1E1E1">
  		<div class="w">
  			<div id="banner-bg" class="i-inner" style="background: url({{ asset('login/a2.jpg') }});"></div>
  		</div>
  	</div>
  </div>
</div>
<div class="w">
	<div id="footer-2013">
		<div class="aui-footer-bot">
			<center>
		    <ul class="time-lists aui-footer-pd clearfix" style="padding:50px;">
		        <li class="aui-footer-list clearfix" style="padding-left:90px;width:120px;display:inline-block;">
		            <h4>
		                <span><img src="{{ asset('icon/icon-d1.png') }}"></span>
		                <em>消费者权益</em>
		            </h4>
		        </li>
		        <li class="aui-footer-list clearfix" style="padding-left:10px;width:120px;display:inline-block;">
		            <h4>
		                <span><img src="{{ asset('icon/icon-d2.png') }}"></span>
		                <em>新手上路</em>
		            </h4>
		        </li>
		        <li class="aui-footer-list clearfix" style="padding-left:10px;width:120px;display:inline-block;">
		            <h4>
		                <span><img src="{{ asset('icon/icon-d3.png') }}"></span>
		                <em>保障正品</em>
		            </h4>
		        </li>
		    </ul>
			</center>
		    <div style="border-bottom:1px solid #dedede"></div>
		    <div class="time-lists aui-footer-pd time-lists-ls clearfix">

		        <div class="aui-footer-list clearfix">
		            <h4>友情链接</h4>
		            <ul>
		                @foreach ($linksArray as $linkArray)
		                <li><a href="{{ $linkArray['url'] }}"> {{ $linkArray['name'] }} </a> </li>
		                @endforeach
		            </ul>
		        </div>
		    </div>
		    <div class="time-lists aui-footer-pd time-lists-ls clearfix">
          <p><h3 style="width:1200px;text-align: center">{{ $sate['desc'] }}</h3></p>
          <p><h3 style="width:1200px;text-align: center">{{ $sate['message'] }}</h3></p>
          <p><h3 style="width:1200px;text-align: center">{{ $sate['record'] }}</h3></p>
		    </div>
		</div>
	</div>
</div>
</body>
<script type="text/javascript" src="{{asset('AdminPublic/lib/jquery/1.9.1/jquery.min.js')}}"></script>
<script type="text/javascript">
phoneumber = 0;
	//alert($)
$(".login-tab-r").click(function(){
	$(".login-box").css({"display":"block","visibility":"visible"});
	$(".qrcode-login").css({"display":"none"})
});
$(".login-tab-l").click(function(){
	$(".login-box").css({"display":"none"});
	$(".qrcode-login").css({"display":"block","visibility":"visible"})
});

// 手机号码失去焦点判断
$('#phone').blur(function(evn) {

		evn = evn || window.event;

		var phone = $('#phone').val();

		$('#phone-error').html('');

		if (phone == '') {
				return false;
		}

		if (phone.length < 11) {
				$('#phone-error').html('');
				$('#phone-error').html('手机号码不能少于十一位');
				evn.preventDefault();
        return false;
		}

		if (phone.length > 11) {
				$('#phone-error').html('');
				$('#phone-error').html('手机号码不能大于十一位');
				evn.preventDefault();
        return false;
		}

		if (phone.length === 11) {
					var result = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/u;
					if (!result.test(phone)) {
						$('#phone-error').html('');
						$('#phone-error').html('手机号不正确');
						evn.preventDefault();
		        return false;
				}
		}

		$.ajax({
        type: 'post',
        url: "{{ route('home.showphone') }}",
        data: "phone="+ phone +"&_token={{ csrf_token() }}",
        dataType: 'JSON',
        success:function(data)
        {
            phoneumber = data;
						if (phoneumber == '2') {
								$('#phone-error').html('');
								$('#phone-error').html('未找到该手机号');
								evn.preventDefault();
				        return false;
						}
        }
    });

});

// 密码登录提交判断
$('#passwordlogin').click(function(evn) {

		evn = evn || window.event;

		var phone = $('#phone').val();
		var password = $('#password').val();

		$('#phone-error').html('');
		$('#password-error').html('');

		if (phone == '') {
				$('#phone-error').html('');
				$('#phone-error').html('手机号码不能为空');
				evn.preventDefault();
        return false;
		}

		if (phone.length < 11) {
				$('#phone-error').html('');
				$('#phone-error').html('手机号码不能少于十一位');
				evn.preventDefault();
        return false;
		}

		if (phone.length > 11) {
				$('#phone-error').html('');
				$('#phone-error').html('手机号码不能大于十一位');
				evn.preventDefault();
        return false;
		}

		if (phone.length === 11) {
				var result = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/u;
				if (!result.test(phone)) {
						$('#phone-error').html('');
						$('#phone-error').html('手机号不正确');
						evn.preventDefault();
		        return false;
				}
		}

		if (phoneumber == '2') {
				$('#phone-error').html('');
				$('#phone-error').html('未找到该手机号');
				evn.preventDefault();
				return false;
		}

		if (password == '') {
				$('#password-error').html('');
				$('#password-error').html('密码不能为空');
				evn.preventDefault();
				return false
		}

    if (password.length < 6) {
				$('#password-error').html('');
				$('#password-error').html('密码不能少于六个字符');
				evn.preventDefault();
				return false
    }

})

/************************************第二个表单********************************************/
validataphone = 0;
sendstatus = 0;
number = 1;
valicaptcha = 0;


$('#sendphone').blur(function(evn) {

		evn = evn || window.event;

		var sendphone = $('#sendphone').val();

		$('#sendphone-error').html('');

		if (sendphone == '') {
				return false;
		}

		if (sendphone.length < 11) {
				$('#sendphone-error').html('');
				$('#sendphone-error').html('手机号码不能少于十一位');
				evn.preventDefault();
        return false;
		}

		if (sendphone.length > 11) {
				$('#sendphone-error').html('');
				$('#sendphone-error').html('手机号码不能大于十一位');
				evn.preventDefault();
        return false;
		}

		if (sendphone.length === 11) {
					var result = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/u;
					if (!result.test(sendphone)) {
						$('#sendphone-error').html('');
						$('#sendphone-error').html('手机号不正确');
						evn.preventDefault();
		        return false;
				}
		}

		$.ajax({
        type: 'post',
        url: "{{ route('home.showphone') }}",
        data: "phone="+ sendphone +"&_token={{ csrf_token() }}",
        dataType: 'JSON',
        success:function(data)
        {
            validataphone = data;
						if (data == '2') {
								$('#sendphone-error').html('');
								$('#sendphone-error').html('未找到该手机号');
								evn.preventDefault();
				        return false;
						} else {
							$('#phonecode').click(function() {
									if (number > 1) {
											return false;
									}

									$.post("{{ route('home.loginvalidata') }}", { "phone": sendphone, "_token": "{{ csrf_token() }}" },function(data) {
	                    sendstatus = data;
											if (sendstatus == 403) {
                        $('#phonecode-error').html('');
                        $("#phonecode-error").html('90秒内只能获取一次！');
                        return false;
                      }
                      if (sendstatus !== 200) {
                        $('#phonecode-error').html('');
                        $("#phonecode-error").html('短信发送失败，请重新获取!');
                        return false;
                      }
                      $('#phonecode-error').html('');

	                    number++;

	                    var time = 90;

	                    var marke = setInterval(function() {

	                        time--;

	                        $("#phonecode").html(time);

	                        if (time < 1) {
	                            clearInterval(marke);
	                            number = 1;
	                            $("#phonecode").html('获取');
	                        }

	                    }, 1000);

	                },'json');

							});
						}
        }
    });
});

$('code').blur(function(evn) {

		evn = evn || window.event;

		if (code == '') {
				$('#phonecode-error').html('');
				$('#phonecode-error').html('验证码不能为空');
				evn.preventDefault();
				return false;
		}

		if (code.length > 6) {
				$('#phonecode-error').html('');
				$('#phonecode-error').html('验证码不能大于六位');
				evn.preventDefault();
				return false;
		}

		if (code.length < 6) {
				$('#phonecode-error').html('');
				$('#phonecode-error').html('验证码不能小于六位');
				evn.preventDefault();
				return false;
		}


});


// 验证码登录提交判断
$('#sendphonemessagesubmit').click(function(evn) {

		evn = evn || window.event;

		var sendphone = $('#sendphone').val();
		var code = $('#code').val();

		$('#sendphone-error').html('');
		$('#phonecode-error').html('');

		if (sendphone == '') {
				$('#sendphone-error').html('');
				$('#sendphone-error').html('手机号码不能为空');
				evn.preventDefault();
        return false;
		}

		if (sendphone.length < 11) {
				$('#sendphone-error').html('');
				$('#sendphone-error').html('手机号码不能少于十一位');
				evn.preventDefault();
        return false;
		}

		if (sendphone.length > 11) {
				$('#sendphone-error').html('');
				$('#sendphone-error').html('手机号码不能大于十一位');
				evn.preventDefault();
        return false;
		}

		if (sendphone.length === 11) {
				var result = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/u;
				if (!result.test(sendphone)) {
						$('#sendphone-error').html('');
						$('#sendphone-error').html('手机号不正确');
						evn.preventDefault();
		        return false;
				}
		}

		if (validataphone == '2') {
				$('#sendphone-error').html('');
				$('#sendphone-error').html('未找到该手机号');
				evn.preventDefault();
				return false;
		}

		if (code == '') {
				$('#phonecode-error').html('');
				$('#phonecode-error').html('验证码不能为空');
				evn.preventDefault();
				return false;
		}

		if (code.length > 6) {
				$('#phonecode-error').html('');
				$('#phonecode-error').html('验证码不能大于六位');
				evn.preventDefault();
				return false;
		}

		if (code.length < 6) {
				$('#phonecode-error').html('');
				$('#phonecode-error').html('验证码不能小于六位');
				evn.preventDefault();
				return false;
		}

		$.post(
				"{{ route('home.valicaptcha') }}",
        {"phone": sendphone, "code": code, "_token": "{{ csrf_token() }}"},
				function(data) {
						valicaptcha = data;
				}
		);


		if (valicaptcha == 403) {
				console.log(valicaptcha);
				$('#phonecode-error').html('');
				$('#phonecode-error').html('验证码已过期');
		}

		if (valicaptcha == 500) {
				$('#phonecode-error').html('');
				$('#phonecode-error').html('验证码错误');
				evn.preventDefault();
				return false;
		}

		if (valicaptcha == 0) {
				$('#phonecode-error').html('');
				$('#phonecode-error').html('验证码错误');
				evn.preventDefault();
				return false;
		}

});
</script>
</html>
